package com.leetcode.partition10;

import java.io.*;
import java.util.Arrays;
import java.util.PriorityQueue;

/**
 * @author `RKC`
 * @date 2022/4/1 16:40
 */
public class LC954二倍数对数组 {

    private static final int N = 100010, M = N << 1;
    private static int[] cnt = new int[M * 2];
    private static PriorityQueue<Integer> heap = new PriorityQueue<>(N, (o1, o2) -> Integer.compare(Math.abs(o1), Math.abs(o2)));
    private static int n;

    private static final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    private static final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        String[] ss = reader.readLine().split(" ");
        int[] arr = new int[ss.length];
        for (int i = 0; i < ss.length; i++) arr[i] = Integer.parseInt(ss[i]);
        writer.write(canReorderDoubled(arr) + "\n");
        writer.flush();
    }

    public static boolean canReorderDoubled(int[] arr) {
        n = arr.length;
        Arrays.fill(cnt, 0);
        heap.clear();
        for (int item : arr) heap.add(item);
        while (!heap.isEmpty()) {
            int x = heap.poll(), t = x * 2;
            if (cnt[x + M] != 0 && --cnt[x + M] >= 0) continue;
            cnt[t + M]++;
        }
        for (int i = 0; i < M * 2; i++) {
            if (cnt[i] != 0) return false;
        }
        return true;
    }
}
